package com.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * @Author 刘志伟
 * @create 2022/9/22 15:43
 */
@Component
public class RobotPublisher {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    public void publishEvent(String name){
        RobotEvent event = RobotEvent.builder().name(name).build();
        applicationEventPublisher.publishEvent(event);
    }

}
